import PlugIn from '../lib/ToolBarPlugIn/index';

export interface IPlugIn {
    title:string
    settingUp: (data?:any) => any
    execute: (data?:any) => any
}
export interface IToolBarPlugIn {
    [index:string]:IPlugIn
}

export default class ToolBarStrategy{
    _plugIn:IToolBarPlugIn = {};
    _keys:string[];

    constructor(){
        this.initPlugIn();
    }

    get plugIn():IToolBarPlugIn{
        return this._plugIn;
    }

    get keys(){
        return this._keys;
    }

    private initPlugIn():IToolBarPlugIn{
        const keys = this._keys = Object.keys(PlugIn);
        keys.forEach((key)=>{
            this._plugIn[key] = new PlugIn[key]();
        });
        return this._plugIn;
    }
}